import com.it.rabbitQM.RabbitMQProducerMain;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * projectName: spring_boot_RabbitQM
 *
 * @author: 王宝贵
 * time: 2024/9/10 20:04 周二
 * description: 路由模式
 */
@SpringBootTest(classes = RabbitMQProducerMain.class)
public class RabbitMQ003 {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public static final String EXCHANGE_DIRECT = "com.exchange.direct";

    public static final String ROUTING_KEY_GOOD = "atguigu.routing.key.good";

    @Test
    public void testSendMessageRouting() {
        rabbitTemplate.convertAndSend(EXCHANGE_DIRECT, ROUTING_KEY_GOOD, "Hello routing ~");
    }

}